<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/8/23
  Time: 14:45
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>暂缓流失</title>

    <link rel="shortcut icon" href="<c:url value="/images/favicon.ico"/>" type="image/x-icon"/>
    <script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
    <script src="<c:url value="/layui/layui.js"/>"></script>
    <link rel="stylesheet" type="text/css" href="<c:url value="/layui/css/layui.css"/>">

    <script src="<c:url value="/js/my/commons.js"/>"></script>
    <style>
        .container {
            width: 1900px;
            margin: -80px auto;
        }

        table {
            width: 100%;
        }
    </style>

</head>
<body class="">

<form class="layui-form layui-form-pane" style="margin-left: 150px" id="acsalesForm">

    <div class="layui-form-item" style="margin-top: 120px;">
        <%--    编号    --%>
        <div class="layui-inline">
            <label class="layui-form-label">编号：</label>
            <div class="layui-input-inline">
                <input id="id" name="id" lay-verify="required" value="1"
                       type="text" autocomplete="off" class="layui-input" placeholder="1" readonly="readonly">
            </div>
        </div>
        <%--    机会来源    --%>
        <div class="layui-inline" style="margin-left: 100px">
            <label class="layui-form-label">客户名称：</label>
            <div class="layui-input-inline">
                <input id="customerName" name="customerName" lay-verify="required"
                       type="text" autocomplete="off" class="layui-input" readonly>
            </div>

        </div>
    </div>

    <div class="layui-form-item">
        <%--     客户名称   --%>
        <div class="layui-inline">
            <label class="layui-form-label">客户经理：</label>
            <div class="layui-input-inline">
                <input id="source" name="normal" lay-verify="required"
                       type="text" autocomplete="off" class="layui-input" readonly>
            </div>
        </div>
        <%--     成功几率   --%>
        <div class="layui-inline" style="margin-left: 100px">
            <label class="layui-form-label">上次下单时间：</label>
            <div class="layui-input-inline">
                <input id="success" name="lastOrderTime" lay-verify="success"
                       type="text" autocomplete="off" class="layui-input" readonly>
            </div>
        </div>
    </div>

    <%--    概要   --%>
    <div class="layui-form-item">
        <label class="layui-form-label">暂缓措施：</label>
        <div class="layui-input-block" style="width: 615px">
            <input id="general" name="measureAppend" lay-verify="required"
                   type="text" autocomplete="off" placeholder="" class="layui-input" readonly>
        </div>
    </div>

    <%--    机会描述   --%>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label" style="width: 723px">追加暂缓措施：</label>
        <div class="layui-input-block" style="width: 723px">
            <textarea id="content" name="content"
                      lay-verify="required" placeholder="请输入追加暂缓措施" class="layui-textarea"></textarea>
        </div>
    </div>


</form>
    <div class="layui-form-item" style="margin-left: 700px">
        <div class="layui-input-block">
            <button class="layui-btn " id="save">保存</button>
        </div>
    </div>

<script>
    layui.use(['form', 'table', 'layer', 'laydate', 'layedit'], function () {
        var table = layui.table
            , form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate
            , layedit = layui.layedit;

    });

</script>
<script>
    $(function () {
        var id = ${param.id};
        $.ajax({
            url: '${pageContext.request.contextPath}/customerLoss/' + id + '.do'
            , success: function (data) {
                $('[name=id]').val(data.data.id);
                $('[name=customerName]').val(data.data.customer.name);
                $('[name=normal]').val(data.data.customer.normal.realName);
                $('[name=lastOrderTime]').val(data.data.lastOrderTime);
                $('[name=measureAppend]').val(data.data.measureAppend);
            }
        });

        $('#save').click(function () {
            let content = $('#content').val();
            let id = $('#id').val();

            $.ajax({
                url: '${pageContext.request.contextPath}/measureAppend.do'
                , type: 'post'
                , data: {
                    id: id
                    , content: content
                }
                , success: function (data) {

                    history.back();
                }
            });
        });

    });

</script>

</body>
</html>
